package test;

import beautiful.butterfly.schedule.task_manager.TaskItemData;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ibm on 2018/4/5.
 */
public class pldhd {

    public static void main(String[] ss) {
        Gson gson = new Gson();
        List<TaskItemData> list = new ArrayList<TaskItemData>();

        TaskItemData taskItemData = new TaskItemData();
        taskItemData.setIndex("1");
        taskItemData.setData("{type=1,kind=1}");


        TaskItemData taskItemData1 = new TaskItemData();
        taskItemData1.setIndex("2");
        taskItemData1.setData("{type=1,kind=2}");


        list.add(taskItemData);
        list.add(taskItemData1);
        System.out.println(gson.toJson(list));

        List<TaskItemData> xx = gson.fromJson(gson.toJson(list), new TypeToken<List<TaskItemData>>() {
        }.getType());

        System.out.println(xx.get(0).getData());
    }
}
